let setSessionStorage = (key, value, isJson) => {
    let _wkey="sessionStorage";
    if (window[_wkey]) {
        if (isJson) {
            value = JSON.stringify(value);
        }

        window[_wkey][key] = value;
    } else {
        console.log("当前浏览器不支持sessionStorage");
    }
}

let getSessionStorage = (key, isJson) => {
    let _wkey="sessionStorage";
    if (window[_wkey]) {
        let value = window[_wkey][key] || "";
        if (isJson && value) {
            value = JSON.parse(value);
        }

        return value;
    } else {
        console.log("当前浏览器不支持sessionStorage");
    }
}

let removeSessionStorage = (name) => {
    let _wkey="sessionStorage";
    if (window[_wkey]) {
        window[_wkey].removeItem(name);
    } else {
        console.log("当前浏览器不支持sessionStorage");
    }
}

export {
    setSessionStorage,
    getSessionStorage,
    removeSessionStorage
}